package com.sky.decorator;

import java.math.BigDecimal;

/**
 * @author : wushikai
 * <p>
 * date : 2020-08-11
 */
public interface MilkTea {

        //奶茶名字
      String getMilkTeaName();
        //奶茶价格
      BigDecimal getMilkTeaPrice();

}


class PearlMilkTea implements MilkTea{


    @Override
    public String getMilkTeaName() {
        return "珍珠奶茶";
    }

    @Override
    public BigDecimal getMilkTeaPrice() {
        return new BigDecimal("15");
    }
}


class HoneyMilkTea implements MilkTea{



    @Override
    public String getMilkTeaName() {
        return "蜂蜜奶茶";
    }

    @Override
    public BigDecimal getMilkTeaPrice() {
        return new BigDecimal("18");
    }
}


/**
 *
 * season  季节
 *
 *
 *Seasoning
 *英   ˈsiːzənɪŋ
 *美  ˈsiːzənɪŋ
 * n. 调味品；佐料；风干；增添趣味的东西
 *
 * */
class SeasoningMilkTea implements MilkTea{


    MilkTea milkTea;
    @Override
    public String getMilkTeaName() {
        return "";
    }

    @Override
    public BigDecimal getMilkTeaPrice() {
        return new BigDecimal("0");
    }
}


class AddRaisinMilkTea extends SeasoningMilkTea {

    MilkTea milkTea;

    private String description ="加了葡萄干的";

    public AddRaisinMilkTea(MilkTea milkTea){

        this.milkTea =milkTea;
    }

    @Override
    public String getMilkTeaName() {
        return this.description + milkTea.getMilkTeaName();
    }

    @Override
    public BigDecimal getMilkTeaPrice() {
        return milkTea.getMilkTeaPrice().add(new BigDecimal("5"));
    }
}

class CoffeeMilkTea extends SeasoningMilkTea {
    MilkTea milkTea;
    private String description="加了咖啡的";

    public CoffeeMilkTea(MilkTea milkTea) {
        this.milkTea = milkTea;
    }


    @Override
    public String getMilkTeaName() {
        return this.description + milkTea.getMilkTeaName();
    }

    @Override
    public BigDecimal getMilkTeaPrice() {
        return milkTea.getMilkTeaPrice().add(new BigDecimal("5"));
    }
}



class Client {

    public static void main(String[] args){

        MilkTea pearMilkTea = new PearlMilkTea();
        System.out.println( pearMilkTea.getMilkTeaName() +  pearMilkTea.getMilkTeaPrice());
        pearMilkTea = new AddRaisinMilkTea(pearMilkTea);
        System.out.println( pearMilkTea.getMilkTeaName() +  pearMilkTea.getMilkTeaPrice());
        pearMilkTea = new CoffeeMilkTea(pearMilkTea);
        System.out.println( pearMilkTea.getMilkTeaName()+ pearMilkTea.getMilkTeaPrice());

    }



}



